package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ContractInvoiceMapper;
import com.ruoyi.system.domain.ContractInvoice;
import com.ruoyi.system.service.IContractInvoiceService;

/**
 * 发票管理Service业务层处理
 *
 * @author ruoyi
 * @date 2024-03-14
 */
@Service
public class ContractInvoiceServiceImpl implements IContractInvoiceService
{
    @Autowired
    private ContractInvoiceMapper contractInvoiceMapper;

    /**
     * 查询发票管理
     *
     * @param id 发票管理主键
     * @return 发票管理
     */
    @Override
    public ContractInvoice selectContractInvoiceById(Long id)
    {
        return contractInvoiceMapper.selectContractInvoiceById(id);
    }
    @Override
    public List<ContractInvoice> selectContractInvoiceByContractId(Long contractId)
    {
        return contractInvoiceMapper.selectContractInvoiceByContractId(contractId);
    }

    /**
     * 查询发票管理列表
     *
     * @param contractInvoice 发票管理
     * @return 发票管理
     */
    @Override
    public List<ContractInvoice> selectContractInvoiceList(ContractInvoice contractInvoice)
    {
        return contractInvoiceMapper.selectContractInvoiceList(contractInvoice);
    }
    @Override
    public List<ContractInvoice> selectContractInvoiceByProjectId(ContractInvoice contractInvoice)
    {
        return contractInvoiceMapper.selectContractInvoiceByProjectId(contractInvoice);
    }

    /**
     * 新增发票管理
     *
     * @param contractInvoice 发票管理
     * @return 结果
     */
    @Override
    public int insertContractInvoice(ContractInvoice contractInvoice)
    {
        contractInvoice.setCreateTime(DateUtils.getNowDate());
        return contractInvoiceMapper.insertContractInvoice(contractInvoice);
    }

    /**
     * 修改发票管理
     *
     * @param contractInvoice 发票管理
     * @return 结果
     */
    @Override
    public int updateContractInvoice(ContractInvoice contractInvoice)
    {
        contractInvoice.setUpdateTime(DateUtils.getNowDate());
        return contractInvoiceMapper.updateContractInvoice(contractInvoice);
    }

    /**
     * 批量删除发票管理
     *
     * @param ids 需要删除的发票管理主键
     * @return 结果
     */
    @Override
    public int deleteContractInvoiceByIds(Long[] ids)
    {
        return contractInvoiceMapper.deleteContractInvoiceByIds(ids);
    }

    /**
     * 删除发票管理信息
     *
     * @param id 发票管理主键
     * @return 结果
     */
    @Override
    public int deleteContractInvoiceById(Long id)
    {
        return contractInvoiceMapper.deleteContractInvoiceById(id);
    }
}
